#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->setupUi(this);
    //生成一个button，指定它的父元素this，也就是Widget
   QPushButton* button = new QPushButton(this);
   button->setText("按钮");
   connect(button, &QPushButton::clicked, this,  &Widget::HandleCilck);
   connect(this, &Widget::CreateSign, this, &Widget::HandleCreateSign);
}

Widget::~Widget()
{
    delete ui;
}

//定义槽函数
void Widget::HandleCilck()
{
//    qDebug() << "Button press";
    //这次我们不直接打印，我们发送信号，让其接收到我们自定义的信号，再进行打印
    emit CreateSign();
}
void Widget::HandleCreateSign()
{
    qDebug() << "Custom signals";

}
